# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=timidity++
pkgver=2.14.0
pkgrel=8
pkgdesc="A MIDI to WAVE converter and player"
arch=('x86_64')
url="http://timidity.sourceforge.net"
license=('GPL')
depends=('libao' 'jack')
makedepends=('xaw3d' 'gtk2' 'tk' 'libxaw')
optdepends=('gtk2: for using the GTK+ interface'
            'tk: for using the Tk interface'
            'xaw3d: for using the Xaw interface')
backup=('etc/timidity++/timidity.cfg')
source=(http://downloads.sourceforge.net/timidity/TiMidity++-${pkgver}.tar.xz
        timidity.cfg timidity.service timidity-tk86.patch timidity-jack.patch)
sha512sums=('d8fc06fa36e4dd42de80c61943da4cd9aec5f8aaf31057a9ededa633d2d48e64c4e53391378d82a7a46ffe4f96c756b010ea9727270f80b134ae1f8bad535bd3'
            '054cd39bef913314e9901171566398af6280236531ac13ece683eaeb642c52b3280116adaa6328054c94bd79b0ab88c253281e386012a2c6d67f4b85c38e4859'
            'b77e460c9803300db67d571d5298edbf4c29a469593c41640057ff8d173ed6edf8b9c2d6cd9a35f6cf1cc32d5b92be38513105f927991fd451725802abb1108b'
            'f7c711fd7aaf924b4469f61780f8b6a282c11246e093b121597a098190ee3ab96964dcc0eb772dfe8232eb95bcfa8819e105eb0f7956b723f84a4df13e72ca98'
            '51c075da04aeedca4edecb5a7f1926ccb80637b550f8fafca6d68be466cd4353a77bbb832878941919ec354c279a6014403e995b9152a47a3817c99890a4afeb')

prepare() {
  cd TiMidity++-${pkgver}
  patch -p1 -i "${srcdir}/timidity-tk86.patch"
  patch -p1 -i "${srcdir}/timidity-jack.patch"
}

build() {
  cd TiMidity++-${pkgver}
  ./configure --prefix=/usr --mandir=/usr/share/man --with-default-path=/etc/timidity++/ \
    --enable-server --enable-alsaseq --enable-spectrogram --enable-network --enable-xft \
    --enable-audio=alsa,oss,ao,vorbis,flac,jack \
    --enable-dynamic=ncurses,tcltk,vt100,xaw,gtk
  make
}

package() {
  cd TiMidity++-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 ../timidity.cfg "${pkgdir}/etc/timidity++/timidity.cfg"
  install -D -m644 ../timidity.service "${pkgdir}/usr/lib/systemd/system/timidity.service"
}
